package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.dto.Menu;
import com.example.entity.vo.response.MenusVO;
import com.example.mapper.MenuMapper;
import com.example.service.MenuService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {
    @Resource
    MenuMapper mapper;

    @Override
    public List<MenusVO> getMuneList() {
        List<Menu> menus = mapper.selectList(null);
        return menus.stream().map(menu -> {
            MenusVO menusVO = new MenusVO();
            BeanUtils.copyProperties(menu, menusVO);
            return menusVO;
        }).toList();
    }
}
